In computer programming, unit testing is a method in which individual units of source code, one or more computer program modules together with associated control data, usage procedures and operating procedures are tested to determine if they are fit for use. Intuitively, a unit can be considered as a small testable part of an application. A unit may be an entire module, but more commonly is an individual function or procedure. In object-oriented programming a unit is often an entire interface, such as a class, but also may be an individual method. Unit tests typically are created by programmers, but occasionally may be created by white box testers during the development process.
Ideally, each unit test is independent from the others: substitutes such as method stubs, mock objects, fakes and test harnesses can be used to assist testing a module in isolation. Unit tests typically are written and executed by software developers to ensure that program code meets its design and behaves as intended. Implementation of a unit test oftentimes is formalized as part of build automation.